﻿using System;
using System.Collections.ObjectModel;
using System.Configuration;

namespace MiniFox.Scripting.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    public class FunctionSettingCollection : KeyedCollection<string, FunctionSetting>, IFunctionSettingCollection
    {
        internal const string ELEMENT_NAME = "functions";

        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override string GetKeyForItem(FunctionSetting item)
        {
            return item.Name;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        IFunctionSetting IFunctionSettingCollection.this[string name] => this[name];

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IEnumerator<IFunctionSetting> IEnumerable<IFunctionSetting>.GetEnumerator()
        {
            return this.GetEnumerator();
        }
    }
}
